<?php /* Smarty version 2.6.20, created on 2013-05-25 06:14:10
         compiled from _core/_include/module/_mvc/control/handlesmry.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'escape', '_core/_include/module/_mvc/control/handlesmry.tpl', 31, false),)), $this); ?>
function HandleSmry(gui, item, options) {
  this._gui = gui;
  this._item = item;
  this._options = options;
  this._popupBox = new PopupBox();

  this._args = (options && options.args) ? options.args : [];
  this._isDeadLine = (options && options.a) ? options.a : 0;
  
  this._createElements();
};

HandleSmry.prototype._createElements = function() {
  this._loadData();
};

HandleSmry.prototype._loadData = function() {
  this._smry = null;
  this._retrieveSmry();
};

HandleSmry.prototype._verifyData = function() {
  if (this._smry) {
    this._updateElements();
  }
};

HandleSmry.prototype._retrieveSmry = function() {
  var _self = this;
  if (this._isDeadLine) {
    new RequestUtils()._mysql('smrydeadline', '&a=' + encodeURIComponent(JSON.stringify(this._args)) + '&b=' + JSON.stringify('<?php echo ((is_array($_tmp=@BRANCH)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
'), function(result, params) { _self._smry = result;
                                                                                                                                                                                                        _self._verifyData.call(_self);
                                                                                                                                                                                                      }, { php: Constant.FACTORY + '/customphp/mysqlcustom.php' });
  } else {
    new RequestUtils()._mysql('smry', '&a=' + encodeURIComponent(JSON.stringify(this._args)) + '&b=' + JSON.stringify('<?php echo ((is_array($_tmp=@BRANCH)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
'), function(result, params) { _self._smry = result;
                                                                                                                                                                                                _self._verifyData.call(_self);
                                                                                                                                                                                              }, { php: Constant.FACTORY + '/customphp/mysqlcustom.php' });
  }
//  if (this._isDeadLine) {
//    new RequestUtils()._custom('smrydeadline', '&a=' + encodeURIComponent(JSON.stringify(this._args)) + '&b=' + JSON.stringify('<?php echo ((is_array($_tmp=@BRANCH)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
'), function(result, params) { _self._smry = result;
//                                                                                                                                                                                                         _self._verifyData.call(_self);
//                                                                                                                                                                                                       }, { php: Constant.FACTORY + '/customphp/jsoncustom.php' });
//  } else {
//    new RequestUtils()._custom('smry', '&a=' + encodeURIComponent(JSON.stringify(this._args)) + '&b=' + JSON.stringify('<?php echo ((is_array($_tmp=@BRANCH)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
'), function(result, params) { _self._smry = result;
//                                                                                                                                                                                                 _self._verifyData.call(_self);
//                                                                                                                                                                                               }, { php: Constant.FACTORY + '/customphp/jsoncustom.php' });
//  }
};

HandleSmry.prototype._updateElements = function() {
  var div, span, tmp;
  DlmanageUtils.clear(this._gui);
  for (var key in this._gui) {
    div = this._gui[key];
    if (!div) {
      continue;
    }
    tmp = this._smry[div.id];
    
    if (tmp.urgent != 0) {
      div.appendChild(document.createTextNode(' ('));
      span = document.createElement('span');
      span.style.color = '#ff0000';
      span.appendChild(document.createTextNode(tmp.urgent));
      div.appendChild(span);
      div.appendChild(document.createTextNode('/' + tmp.total + ')'));
    } else {
      div.appendChild(document.createTextNode(' (' + tmp.urgent + '/' + tmp.total + ')'));
    }
  }
};